<?php

return [
    'id'           => 'basic',
    'basePath'     => APP_PATH . DS . 'app',
    'vendorPath'   => APP_PATH . DS . 'vendor',
    'runtimePath'  => APP_PATH . DS . 'runtime',
    'bootstrap'    => ['admin', 'api', 'log', 'gii'],
    'language' => 'zh-CN',  //目标语言
    'aliases'      => [
        '@Overtrue/Pinyin' => '@app/vendor/pinyin/src',
    ],
    'modules'      => [
        'admin'    => [
            'class' => 'app\modules\admin\adminModule',
        ],
        'api'      => [
            'class' => 'app\modules\api\apiModule',
        ],
        'test' => [
            'class' => 'app\modules\test\testModule',
        ],
        'debug'    => [
            'class' => 'yii\debug\Module',
        ],
        'gii'      => [
            'class'      => 'yii\gii\Module',
            'allowedIPs' => ['127.0.0.1', '::1', '192.168.0.*', '192.168.109.128'], // 按需调整这里
        ],
    ],
    'components'   => [

        'request'      => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'abc1251511',
        ],
        'cache'   => [
            'class' => 'yii\redis\Cache',
            'redis' => [
                'hostname' => '127.0.0.1',
                'port'     => 6379,
                'database' => 5,
            ],
        ],
        
        'user'         => [
            'identityClass'   => 'app\models\UserIdentity',
            'enableAutoLogin' => true,
        ],
        'errorHandler' => [
            'errorAction' => 'error/index',
        ],
        'mailer'       => [
            'class'            => 'yii\swiftmailer\Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'log'          => [
            'traceLevel' => 3,
            'targets'    => [
                [
                    'class'  => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db'           => [
            'class'       => 'yii\db\Connection',
            'dsn'         => 'mysql:host=127.0.0.1;port=3306;dbname=yii2cms',
            'username'    => 'root',
            'password'    => '',
            'charset'     => 'utf8',
            'tablePrefix' => 'yii2_', //加入前缀名称
        ],
        
        'urlManager'   => [
            'enablePrettyUrl' => true,
            'showScriptName'  => false,
            'rules'           => [

            ],
        ],
    ],
    'defaultRoute' => 'admin/default/index',
    'params'       => require __DIR__ . '/params.php',
];
